		function MyWebSocket(ele, requestUrl) {
				this.ele = ele;
				this.requestUrl = requestUrl;
				this.isClose=true;
				this.message="";
				this.rsocket = null;
				this.onMsg = null;
			};
			MyWebSocket.prototype = {
				init: function() {
					let _This = this;
					if(window.location.protocol == 'http:') {
						_This.connect('ws://' + _This.requestUrl);
					} else {
						_This.connect('wss://' + _This.requestUrl);
					}
				},
				connect: function(curl) {
					let _This = this;
					if('WebSocket' in window) {
						_This.rsocket = new WebSocket(curl);
					} else if('MozWebSocket' in window) {
						_This.rsocket = new MozWebSocket(curl);
					} else {
						return;
					};
					_This.rsocket.onopen = function() {
					    _This.isClose=false;
						_This.ele && (_This.ele.onkeydown = function(event){
							if(event.keyCode == 13) {
								_This.sendMessage();
							}
						});
					};
					_This.rsocket.onmessage = function(msg) {
					    _This.message=msg.data;
					   // console.log(_This.message);
					};
					_This.rsocket.onclose = function() {						
						  _This.isClose=true;
					};
					_This.rsocket.onerror = function() {
						_This.isClose=true;
					};
				},
				sendMessage: function() {
					let _This = this;
					var message = _This.ele.value;
					if(message != '') {
					_This.rsocket&&_This.rsocket.readyState
!=3&&_This.rsocket.send(message);
						_This.ele.value = '';
					}
				}
			}
